package cn.wolfcode.wolf2world.utils;

import org.joda.time.DateTime;
import org.joda.time.Duration;

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 * @author 杨兴健
 * @Date 2020/8/17 21:54
 */
public class DateUtil {

    /**
     * 获取今天剩余时间
     * @return
     */
    public static Long getSurplusTime() {
        Calendar calendar = Calendar.getInstance(Locale.TRADITIONAL_CHINESE);

        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR_OF_DAY,23);
        calendar.set(Calendar.MINUTE,59);
        calendar.set(Calendar.SECOND,59);


        return Math.abs((System.currentTimeMillis() - calendar.getTimeInMillis())/1000);
    }


    public long getddd() {
        DateTime dateTime = new DateTime().millisOfDay().withMaximumValue();
        return new Duration(new DateTime(), dateTime).getStandardSeconds();

    }

}
